package com.oocl.ita.winton.Main;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

import com.geralt.im.tool.HtmlBuilder;
import com.oocl.ita.winton.modle.ServerInfo;

public class TestGetCommand {
	public static void main(String[] args) {
		try {
			ServerSocket server = new ServerSocket(8088);
			Socket socket = server.accept();
			InputStream is = socket.getInputStream();
			OutputStream os = socket.getOutputStream();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			String line = null;
			line = br.readLine();
			System.out.println(line);
			ServerInfo testInfo = new ServerInfo();
			testInfo.setStrartTime("217-7-21 1:36");
			testInfo.setRunTimeLong("24h");
			List<String> userList = new ArrayList<String>();
			userList.add("test1");
			userList.add("test2");
			userList.add("test3");
			userList.add("test4");
			testInfo.setOnlineUsers(userList);
			os.write(HtmlBuilder.buildHtml(testInfo).getBytes());
			os.flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
